<?php

require_once('php/lib/mvc/view.php');

/**
 * PHP view for content.
 *
 * @author Pascal de Vink
 */
class PhpContent extends View {
	
	/**
	 * Content (private so it doesn't get registered with php).
	 *
	 * @var string
	 * @access private
	 */
	var $_content;
	
	/**
	 * Constructs new instance.
	 *
	 * @param string $content Content for view
	 * @access public
	 */
	function __construct($content) {
		parent::__construct();
		$this->_content = $content;
	}

	/**
	 * @see View::render()
	 */
	function render() {
		
		# register all view variables as 'globals' for PHP file
		foreach (array_keys(get_object_vars($this)) as $var) {
			if (substr($var, 0, 1) == '_') continue;
			$$var =& $this->$var;
		}
		# display content
		print(eval('?>' . $this->_content . '<?php '));
	}
}
?>